@using BlazorApp.Pages.Common
@using BlazorApp.Pages.Common.Metadata
@using BlazorApp.Utils
@using k8s.Models
@if (Backend != null)
{
    @if (Backend.Resource != null)
    {
        <span>
            <ColorfulTag>@($"Resource: {Backend.Resource.ApiGroup}/{Backend.Resource.Kind}:{Backend.Resource.Name}") </ColorfulTag>
            <KubectlExplainButton Field="ingress.spec.rules.http.paths.backend.resource"></KubectlExplainButton>
        </span>
    }

    @if (Backend.Service != null)
    {
        <RefView FullView="true" Ref="@KubeHelper.GetObjectRef("Service", Namespace, Backend.Service.Name)">
        </RefView>
        <ColorfulTag>@($"{Backend.Service.Port.Name}{Backend.Service.Port.Number}") </ColorfulTag>
        <KubectlExplainButton Field="ingress.spec.rules.http.paths.backend.service"></KubectlExplainButton>
    }
}


@code {

    [Parameter] public V1IngressBackend Backend { get; set; }

    [Parameter] public string Namespace { get; set; }

}
